﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NetDaily.aspx.cs" Inherits="Caifu.WebSite.NetDaily" %>

<%@ OutputCache VaryByParam="none" Duration="6" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<title>基金净值 - 财富520</title>
	<meta name="description" content="最纯粹的个人投资理财平台。财富520基金频道，提供最新、最快、最准确的开放式基金每日净值，为中国基民购基、选基、养基提供决策参考。" />
	<meta name="keywords" content="基金,净值,理财,基金净值,定投,基金查询,开放式基金,我的基金,基金公司,基金经理,基金数据,基金公告,基金排名,基金行情" />
	<link href="/Statics/Styles/Index.css" rel="stylesheet" type="text/css" />
	<script src="/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
</head>
<body>
	<form id="form1" runat="server">
	<cf:WebHeader ID="WebHeader" runat="server" />
	<div class="quotation01">
		<div class="quo02" id="ui_sh000001">
			<b>上证指数：</b> <span class="sp3">--</span> <span class="sp2">-- (--%)</span>
		</div>
		<div class="quo02 quo02" id="ui_sz399001">
			<b>深证成数：</b> <span class="sp3">--</span> <span class="sp1">-- (--%)</span>
		</div>
		<div class="quo02 quo03" id="ui_sz399300">
			<b>沪深300：</b> <span class="sp3">--</span> <span class="sp1">-- (--%)</span>
		</div>
	</div>
	<div class="mainbutton">
		<ul>
			<li class="on">开放式基金净值排行</li>
		</ul>
	</div>
	<div class="button01">
		<div class="but01 but02">
			<ul>
				<%--<li class="b02">我关注的基金</li>--%>
				<li id="all_fund">全 部</li>
				<li id="stock_fund">股票型 </li>
				<li id="mixed_fund">混合型</li>
				<li id="bond_fund">债券型</li>
			</ul>
		</div>
	</div>
	<!--jz_list_start-->
	<div class="content01 jz_list">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab02 t02">
			<thead>
				<tr>
					<th width="7%">
						序号
					</th>
					<th width="8%">
						基金代码
					</th>
					<th width="18%">
						基金名称
					</th>
					<th width="9%" class="l18">
						最新净值
					</th>
					<th width="9%">
						前一日净值
					</th>
					<th width="9%">
						涨跌额
					</th>
					<th width="11%">
						涨跌幅
					</th>
					<th width="9%">
						净值日期
					</th>
					<%--                    <th width="9%">
                        操作
                    </th>--%>
				</tr>
			</thead>
			<tbody id="mainlist">
				<tr>
					<td colspan="20">
						数据加载中...
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	<!--jz_list_end-->
	</form>
	<cf:WebFooter ID="WebFooter" runat="Server" />
</body>
</html>
<script src="../Statics/Scripts/QQData.js" type="text/javascript"></script>
<script type="text/javascript">
	$(function () {
		var url = "http://qt.gtimg.cn/q=s_sh000001,s_sz399001,s_sz399300";
		$.getScript(url, minStockIndex)
	})
</script>
<script type="text/javascript">
	var nvData;

	function getColor(v) {
		if (v == "--") return "";
		var d = parseFloat(v);
		if (d > 0) return "red"
		else if (d < 0) return "green";
		else return "";
	}

	function buildRows(exp) {
		$("#mainlist").html('<tr><td colspan="20">数据加载中...</td></tr>');
		var header = nvData[0];

		var i_Category, i_FundCode, i_FundName;
		var i_UnitNetValue, i_PreviousUnitNetValue;
		var i_GrowthValue, i_GrowthRate, i_ReportDate;

		for (var i in header) {
			if (header[i] == "Category") i_Category = i;
			else if (header[i] == "FundCode") i_FundCode = i;
			else if (header[i] == "FundName") i_FundName = i;
			else if (header[i] == "UnitNetValue") i_UnitNetValue = i;
			else if (header[i] == "PreviousUnitNetValue") i_PreviousUnitNetValue = i;
			else if (header[i] == "GrowthValue") i_GrowthValue = i;
			else if (header[i] == "GrowthRate") i_GrowthRate = i;
			else if (header[i] == "ReportDate") i_ReportDate = i;
		}

		var t
			= '<tr>'
			+ ' <td>{id}</td>'
			+ ' <td class="l01"><a href="#" target="_self">{FundCode}</a></td>'
			+ ' <td><a href="#" target="_self">{FundName}</a></td>'
			+ ' <td>{UnitNetValue}</td>'
			+ ' <td>{PreviousUnitNetValue}</td>'
			+ ' <td class="{css}">{GrowthValue}</td>'
			+ ' <td class="{css}">{GrowthRate}</td>'
			+ ' <td>{ReportDate}</td>'
			+ '</tr>';

		var listHtml = "";
		for (var i in nvData) {
			if (i == 0) continue;

			if (exp != undefined || exp == "all") {
				if (nvData[i][i_Category] != exp) continue;
			}

			listHtml += t
					.replace("{id}", i)
					.replace("{FundCode}", nvData[i][i_FundCode])
					.replace("{FundName}", nvData[i][i_FundName])
					.replace("{UnitNetValue}", nvData[i][i_UnitNetValue])
					.replace("{PreviousUnitNetValue}", nvData[i][i_PreviousUnitNetValue])
					.replace("{GrowthValue}", nvData[i][i_GrowthValue])
					.replace("{GrowthRate}", nvData[i][i_GrowthRate])
					.replace("{ReportDate}", nvData[i][i_ReportDate])
					.replace(/{css}/g, getColor(nvData[i][i_GrowthValue]));

		}

		$("#mainlist").html(listHtml);
	}

	$(function () {
		$.getScript("/HQ/Q.aspx", function (data) {
			nvData = eval(data);
			buildRows();
		});

		$("#all_fund").click(function () { buildRows() });
		$("#stock_fund").click(function () { buildRows("stock") });
		$("#mixed_fund").click(function () { buildRows("mixed") });
		$("#bond_fund").click(function () { buildRows("bond") });
	});
</script>
